
// 返回上一页面
function back(){
	window.history.back(-1);
}

// 当标题和正文为空时禁用button
function change_button() {
	var title = document.getElementById('title').innerHTML.toString();
	var content = document.getElementById('content').innerHTML.toString();
	var obj = document.getElementById('send');
	if(content === "" && title === ""){
		obj.disabled = true;
	}
}

// 当标题或者正文内容发生改变时，修改标题和正文的字体颜色颜色，以及解禁button
function text_change() {
	var content = document.getElementById('content');
	var title = document.getElementById('title');
	var obj = document.getElementById('send');
	obj.disabled = false;
	obj.style.cssText = "color: #000000;"
	title.style.cssText = "color : #000000";
	content.style.cssText = "color: #000000;"
}

function upload() {
	var title = document.getElementById('title').value;
	var content = document.getElementById('content').value;
	var getTime = new Date().toDateString();
	mui.post('http://127.0.0.1:8080/healthTp/public/Promulgate/Article/save', //请求，地址
	{   ID:1,
		title:title,
		content:content,
		time:getTime
	},
	function(data){ //服务器返回数据回来时应该做什么的函数
		if(data) {
			mui.alert("发布成功!");
		}
		else{
			mui.alert("请稍后再试试！");
		}
	}, 
	'json');
}
